import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

// 路由表
const routes = [
  {
    path: '/',
    redirect: '/layout'
  },
  {
    path: '/login',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login')
  },
  // 我的
  // {
  //   path: '/my',
  //   name: 'my',
  //   component: () => import('@/views/my/index.vue')
  // },
  // 新增地址
  {
    path: '/myAddress',
    name: 'Address',
    component: () => import('@/views/my/my-address/my-address.vue')
  },
  {
    path: '/newAddress',
    name: 'newAddress',
    component: () => import('@/views/my/my-address/new-address.vue')
  },
  // 编辑地址
  {
    path: '/editAddress',
    name: 'editAddress',
    component: () => import('@/views/my/my-address/edit-address.vue')
  },
  // 帮助中心
  {
    path: '/my/helpCenter',
    name: 'helpCenter',
    component: () => import('@/views/my/help-center')
  },
  // 推广赚钱
  {
    path: '/promotionShop',
    name: 'promotionShop',
    component: () => import('@/views/my/help-center/promotion-shop.vue')
  },
  // 收藏店铺（个人商圈）
  {
    path: '/collectionStores',
    name: 'collectionStores',
    component: () => import('@/views/my/Collection-stores')
  },
  // 我的推广
  {
    path: '/my/myCollection',
    name: 'myCollection',
    component: () => import('@/views/my/my-collection')
  },
  // 进店记录
  {
    path: '/my/storesRecord',
    name: 'storesRecord',
    component: () => import('@/views/my/stores-record')
  },
  {
    path: '/layout',
    name: 'layout',
    component: () => import('@/views/layout'),
    children: [
      {
        path: '',
        component: () => import('@/views/home/index.vue'), // 我的商圈
        redirect: '/home/goods',
        children: [
          {
            path: '/home/goods',
            name: 'goods',
            component: () => import('@/views/goods')
          }
        ]
      },
      {
        path: '/my',
        name: 'my',
        component: () => import('@/views/my')
      },
      {
        path: '/shangQua',
        name: 'shangQua',
        component: () => import('@/views/shangQua/index.vue')
      },
      {
        path: '/search',
        name: 'search',
        component: () => import('@/views/search')
      },
      {
        path: '/order',
        name: 'order',
        component: () => import('@/views/order'),
        children: [
          {
            path: '/order/ticket/use',
            name: 'ticketUse',
            component: () => import('@/views/order/components/ticket-get.vue')
          }
        ]
      },
      {
        path: '/homeIndustry',
        name: 'homeIndustry',
        component: () => import('@/views/home/homeIndustry') // 行业页面
      },
      {
        path: '/applyStore',
        name: 'applyStore',
        component: () => import('@/views/applyStore') // 申请开店页面
      },
      {
        path: '/pushMoney',
        name: 'pushMoney',
        component: () => import('@/views/pushMoney') // 推广赚钱页面
      },
      {
        path: '/order/ticket/get',
        name: 'ticketGet',
        component: () => import('../views/order/components/ticket-get.vue')
      }
    ]
  },
  {
    path: '/myStores',
    name: 'myStores',
    component: () => import('@/views/myStores')
  },
  {
    path: '/searchPage',
    name: 'searchPage',
    component: () => import('@/views/searchPage') // 搜索页面
  },
  {
    path: '/order/payment',
    name: 'payment',
    component: () => import('@/views/order/components/order-payment')
  },
  {
    path: '/order/dispatching',
    name: 'dispatching',
    component: () => import('@/views/order/components/order-dispatching')
  },
  {
    path: '/order/pick',
    name: 'pick',
    component: () => import('@/views/order/components/order-pick')
  },
  {
    path: '/order/take',
    name: 'take',
    component: () => import('@/views/order/components/order-take')
  },
  {
    path: '/order/vending',
    name: 'vending',
    component: () => import('@/views/order/components/order-vending')
  },
  {
    path: '/order/refund',
    name: 'refund',
    component: () => import('../views/order/components/order- refund.vue')
  },
  {
    path: '/edit',
    name: 'edit',
    component: () => import('@/views/my/edit') // 我的编辑
  },
  {
    path: '/mycart',
    name: 'macart',
    component: () => import('@/views/my/my-cart') // 我的购物车
  },
  {
    path: '/my/order',
    name: 'myorder',
    component: () => import('@/views/my/my-cart/order') // 多订单确认
  },
  {
    path: '/my/wallet',
    name: 'mywallet',
    component: () => import('@/views/my/my-wallet') // 我的钱包
  },
  {
    path: '/my/coupon',
    name: 'mycoupon',
    component: () => import('@/views/my/my-coupon') // 我的优惠券
  },
  {
    path: '/myDianPu',
    name: 'myDianPu',
    component: () => import('@/views/myStores/my-stores.vue')
  }
]

const router = new VueRouter({
  routes
})

export default router
